headerbar: Avoid allocating 0 visible children
authorTimm Bäder <mail@baedert.org>
Mon, 28 Aug 2017 09:07:35 +0000 (11:07 +0200)
committerTimm Bäder <mail@baedert.org>
Mon, 28 Aug 2017 09:17:47 +0000 (11:17 +0200)
Ths avoids doing a bunch of work as well as passing 0 to g_alloca which
is undefined.

gtk/gtkheaderbar.c

index 5b8ca74abd770ca17707e6cb0866b75a52f864f6..bfaf41bbc2fe475b60c8257f4ef9966667514640 100644 (file)
@@ -932,6 +932,10 @@ gtk_header_bar_size_allocate (GtkWidget           *widget,
 
   direction = gtk_widget_get_direction (widget);
   nvis_children = count_visible_children (bar);
+
+  if (nvis_children == 0)
+    return;
+
   sizes = g_newa (GtkRequestedSize, nvis_children);
 
   width = allocation->width - nvis_children * priv->spacing;